import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/Home.vue";

import index from "@/views/index/index";
import test from '@/views/index/test';

import videoinfo from "@/views/videoinfo/videoinfo";

import flyrecord from "@/views/flyrecord/flyrecord";
import flydata from "@/views/flyrecord/flydata";
import flyvideo from "@/views/flyrecord/flyvideo";


import query from "@/views/query/query";
import analysis from "@/views/query/analysis";
import detection from "@/views/query/detection";

import register from "@/views/register/register";
Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "无人机管理平台",
    component: Home,
    redirect: '/index',
    children: [
      {
        path: "/index",
        name: "首页",
        component: index,
      }, {
        path: "/test",
        name: "测试",
        component: test,
      },
      {
        path: "/videoinfo",
        name: "实时影像",
        component: videoinfo,
      },
      {
        path: "/flyrecord",
        name: "飞行记录",
        component: flyrecord,
        children: [
          {
            path: "/flydata",
            name: "历史飞行参数",
            component: flydata,
          },
          {
            path: "/flyvideo",
            name: "历史飞行影像",
            component: flyvideo,
          },
        ],
      },
      {
        path: "/query",
        name: "综合查询",
        component: query,
        children: [
          {
            path: "/analysis",
            name: "区域分析",
            component: analysis,
          },
          {
            path: "/detection",
            name: "目标检测",
            component: detection,
          },
        ]
      },
      {
        path: "/register",
        name: "无人机注册",
        component: register,
      },
    ],
  },
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;